# Contributor: Jason Qiu <jasonwqiu@gmail.com>

_realname=isodate
pkgbase=mingw-w64-python-${_realname}
pkgver=0.6.1
pkgrel=2
pkgdesc="An ISO 8601 date/time/duration parser and formatter"
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://github.com/gweis/isodate/"
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-six")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${pkgver}.tar.gz::https://files.pythonhosted.org/packages/source/i/isodate/isodate-$pkgver.tar.gz")
sha1sums=('ea36ce1c780dd44f01225dca7f9995a6685a60cc')

prepare() {
    cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build 
}

check() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py pytest
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python setup.py install --prefix="${MINGW_PREFIX}" \
        --root="${pkgdir}" --optimize=1 --skip-build
}
